class MapMixin:
    def __getitem__(self, key):
        return self.__dict__[key]
    
    def __setitem__(self, key, value):
        self.__dict__[key] = value

class Student(MapMixin):
    def __init__(self, name, age) -> None:
        self.name = name
        self.age = age
        
s = Student("jack", 20)

# 正常打印name属性的方式
print(s.name)

# 如何使用s["name"]的方式获取name属性？
print(s["name"])
print(s.__dict__)